<template>
	<div id="backtop"  @click="goTop()">
		<img src="../../assets/img/common/top.png" >
	</div>
</template>

<script>
		
	export default{
		name:'BackTop',

		methods:{
			backClick(){//到某一个位置的时候显示图标
				let res = document.body.scrollTop || document.documentElement.scrollTop;
				if(res >= 100){
					this.style.display = 'block';
				} else {
					this.style.display = 'none';
				}
			},
			goTop(){//返回顶部方法
				document.body.scrollTop = 0 ;
				document.documentElement.scrollTop = 0;
			}
			
		}
	}
</script>

<style scoped="scoped">
	#backtop{
		position: fixed;
		right: 10px;
		bottom: 60px;
	}
</style>
